class Cache {
  setItem(key, val) {
    window.localStorage.setItem(key, JSON.stringify(val));
  }
  getItem(val) {
    const value = window.localStorage.getItem(val);
    if (value) {
      return JSON.parse(value);
    }
  }
  deleteItem(key) {
    window.localStorage.deleteItem(key);
  }
  clearItem() {
    window.localStorage.clear();
  }
}

export default new Cache();
